package io.openmessaging.demo;

import io.openmessaging.BytesMessage;
import io.openmessaging.MessageFactory;
import io.openmessaging.MessageHeader;

public class DefaultMessageFactory implements MessageFactory {

	DefaultBytesMessage message = new DefaultBytesMessage(true);
	
    @Override 
    public BytesMessage createBytesMessageToTopic(String topic, byte[] body) {
		message.reset();
		message.init(topic, body, MessageHeader.TOPIC);		
        return message;
    }

    @Override 
    public BytesMessage createBytesMessageToQueue(String queue, byte[] body) {
		message.reset();
		message.init(queue, body, MessageHeader.QUEUE);
        return message;
    }
   
}
